package a.f.l;

import a.c.m;
import a.c.v;
import a.c.z;
import a.d.w;
import a.f.o;
import a.f.r;
import a.f.rc;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class d
  extends r
{
  public static final Object g = "CollinearBendHider#SELECTED_EDGES";
  public static boolean h;
  
  public d(rc paramrc)
  {
    super(paramrc);
  }
  
  public boolean canLayout(o paramo)
  {
    return true;
  }
  
  public void doLayout(o paramo)
  {
    int n = g.Cc;
    int m = g.Bc;
    ArrayList localArrayList = new ArrayList();
    a.c.k localk = paramo.c(g);
    Object localObject1 = paramo.w();
    Object localObject2;
    z localz;
    Object localObject3;
    Object localObject4;
    w localw2;
    label281:
    label299:
    do
    {
      if (!((m)localObject1).e()) {
        break;
      }
      localObject2 = ((m)localObject1).a();
      if (m != 0) {
        break label363;
      }
      if ((n != 0) || (localk != null))
      {
        if (n != 0) {
          continue;
        }
        if (!localk.getBool(localObject2)) {}
      }
      else
      {
        localz = paramo.o((a.c.d)localObject2);
        localObject3 = localz.f();
        localObject4 = (w)((v)localObject3).c();
        localObject3 = ((v)localObject3).a();
        Object localObject5 = (w)((v)localObject3).c();
        int j = 1;
        int k = localz.size();
        a_ locala_ = new a_((a.c.d)localObject2, j);
        localObject3 = ((v)localObject3).a();
        if (localObject3 != null) {}
        while (n != 0)
        {
          localw2 = (w)((v)localObject3).c();
          if (m != 0) {
            break label299;
          }
          if (a.d.k.d((w)localObject4, localw2, (w)localObject5))
          {
            locala_.c.add(new Double(((w)localObject4).a((w)localObject5)));
            localz.h(((v)localObject3).b());
            localObject5 = localw2;
            if (n != 0) {
              break label281;
            }
            if (m == 0) {}
          }
          else
          {
            a((w)localObject4, (w)localObject5, locala_, localArrayList);
            locala_ = new a_((a.c.d)localObject2, j + 1);
            localObject4 = localObject5;
            localObject5 = localw2;
          }
          localObject3 = ((v)localObject3).a();
          j++;
          if (m == 0) {
            break;
          }
        }
        if (!locala_.c.isEmpty()) {
          a((w)localObject4, (w)localObject5, locala_, localArrayList);
        }
        if (n != 0) {
          continue;
        }
        if (localz.size() < k) {
          paramo.a((a.c.d)localObject2, localz);
        }
      }
      ((m)localObject1).f();
    } while (m == 0);
    if (n == 0) {
      a().doLayout(paramo);
    }
    label363:
    localObject1 = localArrayList.iterator();
    label377:
    label633:
    do
    {
      if (!((Iterator)localObject1).hasNext()) {
        break;
      }
      break label430;
      localObject2 = (a_)((Iterator)localObject1).next();
      do
      {
        localz = paramo.o(((a_)localObject2).a);
        w localw1;
        do
        {
          localObject3 = (w)localz.a();
          localObject4 = localz.f();
          int i = ((a_)localObject2).b;
          do
          {
            if (localObject4 == null) {
              break label479;
            }
            if (m != 0) {
              break;
            }
            if (i <= 0) {
              break label479;
            }
            if (n == 0)
            {
              if (i == 1) {
                localObject3 = (w)((v)localObject4).c();
              }
              localObject4 = ((v)localObject4).a();
              i--;
            }
          } while (m == 0);
          if (n != 0) {
            break label377;
          }
          if (localObject4 == null) {
            break;
          }
          localw1 = (w)((v)localObject4).c();
        } while (n != 0);
        Iterator localIterator = ((a_)localObject2).c.iterator();
        do
        {
          if (!localIterator.hasNext()) {
            break;
          }
          double d = ((Double)localIterator.next()).doubleValue();
          localw2 = new w(((w)localObject3).a + d * (localw1.a - ((w)localObject3).a), ((w)localObject3).b + d * (localw1.b - ((w)localObject3).b));
          localz.a(localw2, (v)localObject4);
          if (n != 0) {
            break label633;
          }
          if (m != 0) {
            break label631;
          }
        } while (m == 0);
      } while (n != 0);
      paramo.a(((a_)localObject2).a, localz);
    } while (m == 0);
    label430:
    label479:
    label631:
    return;
  }
  
  private void a(w paramw1, w paramw2, a_ parama_, List paramList)
  {
    if (g.Cc == 0)
    {
      if (parama_.a()) {
        return;
      }
      parama_.a(paramw1, paramw2);
    }
    paramList.add(parama_);
  }
  
  private static class a_
  {
    a.c.d a;
    int b;
    List c = new ArrayList();
    
    public a_(a.c.d paramd, int paramInt)
    {
      this.a = paramd;
      this.b = paramInt;
    }
    
    public boolean a()
    {
      return this.c.isEmpty();
    }
    
    public void a(w paramw1, w paramw2)
    {
      int j = g.Cc;
      int i = g.Bc;
      double d1 = paramw1.a(paramw2);
      if (d1 > 0.0D)
      {
        ArrayList localArrayList = new ArrayList();
        Iterator localIterator = this.c.iterator();
        if (localIterator.hasNext()) {}
        while (j != 0)
        {
          double d2 = ((Double)localIterator.next()).doubleValue();
          localArrayList.add(new Double(d2 / d1));
          if ((j == 0) && (i != 0)) {
            return;
          }
          if (i == 0) {
            break;
          }
        }
        this.c = localArrayList;
      }
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.l.d

 * JD-Core Version:    0.7.0.1

 */